import Http from '../http';
import { UpdateDataStateInput } from '@/model/public/public';
import { FlowInput } from '@/model/flow/flowModel';

//新增流程
export const InsertFlow = function (flow: FlowInput) {
  return Http.post('/api/Flow/Insert', flow)
}

//更新流程
export const UpdateFlow = function (flow: FlowInput) {
  return Http.post('/api/Flow/Update', flow)
}

//获取流程
export const GetAllFlow = async function (pageResultModel: any) {
  return await Http.post('/api/Flow/GetAllFlow', pageResultModel);
}

//根据主键获取流程
export const GetFlowByFlowId = async function (params: { flowId: string }) {
  return await Http.get('/api/Flow/GetFlowByFlowId', params)
}

//获取流程节点配置
export const GetExpireDate = async function (params: { flowId: string, flowNodeId: string }) {
  return await Http.get('/api/Flow/GetExpireDate', params)
}
//更新数据状态
export const UpdateFlowDataState = function (input: UpdateDataStateInput) {
  return Http.post('/api/Flow/UpdateFlowDataState', input)
}

//获取部门流程树形结构
export const GetDepartmentFlow = async function () {
  return await Http.get('/api/Flow/GetDepartmentFlow');
}

//根据流程id获取流程和表单数据
export const GetFlowOrFormByFlowId = async function (params: { flowId: string }) {
  return await Http.get('/api/Flow/GetFlowOrFormByFlowId', params);
}